﻿namespace FacadePattern.EncryptionModuleSample
{
    /// <summary>
    /// 新增（具体）外观类
    /// </summary>
    class NewEncryptFacade : AbstractEncryptFacade
    {
        private readonly FileReader reader;
        private readonly NewCipherMachine cipher;
        private readonly FileWriter writer;

        public NewEncryptFacade()
        {
            reader = new FileReader();
            cipher = new NewCipherMachine();
            writer = new FileWriter();
        }

        public override void FileEncrypt(string fileNameSrc, string fileNameDes)
        {
            string plainStr = reader.Read(fileNameSrc); //文件读取，充当子系统
            string encryptStr = cipher.Encrypt(plainStr); //数据加密，充当子系统
            writer.Write(encryptStr, fileNameDes); //文件保持，充当子系统
        }
    }
}
